package com.jxzyk.entity.tree;

import java.util.ArrayList;
import java.util.List;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.core.entity.I_List;
import com.core.entity.JsonEntity;

public class Outlines extends JsonEntity {
	private String outlineid;
	private List<Outline> children = new ArrayList<>();
	private List<I_List> material = new ArrayList<>();
	private String outlinetitle;

	public String getOutlinetitle() {
		return outlinetitle;
	}

	public void setOutlinetitle(String outlinetitle) {
		this.outlinetitle = outlinetitle;
	}

	public Outlines() {
		super();
	}

	public Outlines(JSONObject json) {
		super();
		try {
			setOutlineid(json.getString("outlineid"));
			setOutlinetitle(json.getString("outlinetitle"));
			JSONArray array = json.getJSONArray("children");
			if (array != null) {
				for (int i = 0; i < array.size(); i++) {
					Outline outline = new Outline(array.getJSONObject(i));
					children.add(outline);
				}
			}
			JSONArray materials = json.getJSONArray("material");
			if (materials != null) {
				for (int i = 0; i < materials.size(); i++) {
					material.add((Material) new Material().instance(materials
							.getJSONObject(i)));
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public List<I_List> getMaterial() {
		return material;
	}

	public void setMaterial(List<I_List> material) {
		this.material = material;
	}

	public String getOutlineid() {
		return outlineid;
	}

	public void setOutlineid(String outlineid) {
		this.outlineid = outlineid;
	}

	public List<Outline> getChildren() {
		return children;
	}

	public void setChildren(List<Outline> children) {
		this.children = children;
	}

}
